package com.gtjy.webserver4j;

public class Status {
	
	
	private int status;
	private String message;
	
	public static Status OK = new Status(200,"OK");
	public static Status BadRequest = new Status(400,"Bad Request");
	public static Status Unauthorized = new Status(401,"Unauthorized");
	public static Status Forbidden = new Status(403,"Forbidden");
	public static Status NotFound = new Status(404,"Not Found");
	public static Status InternalServerError = new Status(500,"Internal Server Error");
	public static Status ServerUnavailable = new Status(503,"Server Unavailable");
	//	200 OK      //客户端请求成功
	//	400 Bad Request  //客户端请求有语法错误，不能被服务器所理解
	//	401 Unauthorized //请求未经授权，这个状态代码必须和WWW-Authenticate报头域一起使用 
	//	403 Forbidden  //服务器收到请求，但是拒绝提供服务
	//	404 Not Found  //请求资源不存在，eg：输入了错误的URL
	//	500 Internal Server Error //服务器发生不可预期的错误
	//	503 Server Unavailable  //服务器当前不能处理客户端的请求，一段时间后可能恢复正常
	public Status(int statusCode,String message) {
		this.status = statusCode;
		this.message = message;
	}

	public int getStatus() {
		return status;
	}

	public String getMessage(){
		return this.getStatus() + " " + message;
	}

	public String toString(){
		return getMessage();
	}
}
